Решение задачи 1
#include <stdio.h>
#include
#include
void main(void)
{
FILE *in, *out;
int i, x, y, z, ochki=0;
float r;
if ((in = fopen("INPUT.TXT", "rt")) == NULL)
{
fprintf(stderr, "Cannot open input file.\n");
return;
}
for (i=0; i<5; i++)
{
fscanf(in,"%d%d",&x,&y);
r=sqrt(x*x+y*y);
z=r;
if (z<2) z=2;
if (z<=11)
ochki+=12-z;
}
if ((out = fopen("OUTPUT.TXT", "wt")) == NULL)
{
fprintf(stderr, "Cannot open output file.\n");
return;
}
fprintf(out,"%d",ochki);
fclose(out);
}
Тесты к задачам по информатике
Сайт создан в системе